<!DOCTYPE html>
<html lang="zh-CN">
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="beans.Employee" %>
<%
    // 从会话中获取用户信息（使用您现有的登录系统）
    Employee employee = (Employee) session.getAttribute("user");
    String role = (String) session.getAttribute("role");
    String username = (String) session.getAttribute("username");

    // 如果没有登录，重定向到登录页面
    if (employee == null || username == null) {
        response.sendRedirect("login.jsp");
        return;
    }
%>
<head>
    <meta charset="UTF-8">
    <title>公司用车管理系统（用车员工）</title>
    <style>

        body {
            margin: 0;
            padding: 0;
            font-family: "Microsoft YaHei", Arial, sans-serif;
            background: #f6f6f6;
        }

        .header {
            background: #183a8a;
            color: #fff;
            font-size: 2rem;
            font-weight: bold;
            padding: 10px 0 10px 10px;
            letter-spacing: 2px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }

        .header-right {
            display: flex;
            align-items: center;
            margin-right: 30px;
            font-size: 1rem;
        }

        .user-icon {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: #fff;
            color: #183a8a;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2rem;
            margin-right: 10px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        }

        .user-info {
            margin-right: 20px;
            color: #fff;
        }

        .bell-icon {
            font-size: 1.3rem;
            margin-right: 20px;
            color: #fff;
            cursor: pointer;
            transition: transform 0.2s;
        }

        .bell-icon:hover {
            transform: scale(1.1);
        }

        .logout {
            color: #fff;
            text-decoration: none;
            margin-left: 10px;
            font-size: 1rem;
            transition: color 0.2s;
        }

        .logout:hover {
            color: #a8c5ff;
        }

        .container {
            display: flex;
            height: calc(100vh - 56px);
        }

        .sidebar {
            width: 220px;
            background: #183a8a;
            display: flex;
            flex-direction: column;
            padding-top: 10px;
            box-shadow: 2px 0 8px rgba(24, 58, 138, 0.05);
        }

        .menu-item {
            color: #fff;
            padding: 18px 0 18px 32px;
            font-size: 1.15rem;
            cursor: pointer;
            border-left: 5px solid transparent;
            transition: background 0.2s, border 0.2s, transform 0.2s;
            text-decoration: none;
            display: block;
        }

        .menu-item.active,
        .menu-item:hover {
            background: #2450a7;
            border-left: 5px solid #fff;
            font-weight: bold;
            box-shadow: 0 4px 8px rgba(24, 58, 138, 0.10);
            transform: translateX(2px);
        }

        .main-content {
            flex: 1;
            background: #f6f6f6;
            padding: 30px;
            overflow-y: auto;
        }

        /* 首页卡片样式 */
        .dashboard {
            max-width: 1200px;
            margin: 0 auto;
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 25px;
        }

        .welcome-card {
            background: #ffffff;
            border-radius: 12px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
            padding: 30px;
            grid-column: 1 / -1;
            background-image: linear-gradient(135deg, #183a8a 0%, #2450a7 100%);
            color: white;
            position: relative;
            overflow: hidden;
        }

        .welcome-card::before {
            content: '';
            position: absolute;
            top: 0;
            right: 0;
            width: 300px;
            height: 300px;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 50%;
            transform: translate(50%, -50%);
        }

        .welcome-card::after {
            content: '';
            position: absolute;
            bottom: 0;
            right: 0;
            width: 200px;
            height: 200px;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 50%;
            transform: translate(30%, 30%);
        }

        .welcome-title {
            font-size: 2.5rem;
            font-weight: bold;
            margin-bottom: 10px;
            position: relative;
            z-index: 1;
        }

        .welcome-subtitle {
            font-size: 1.2rem;
            color: rgba(255, 255, 255, 0.8);
            margin-bottom: 20px;
            position: relative;
            z-index: 1;
        }

        .welcome-user {
            display: flex;
            align-items: center;
            position: relative;
            z-index: 1;
        }

        .welcome-avatar {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            background: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2.5rem;
            color: #183a8a;
            margin-right: 20px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }

        .welcome-name {
            font-size: 1.5rem;
            font-weight: bold;
        }

        .welcome-role {
            font-size: 1rem;
            color: rgba(255, 255, 255, 0.8);
        }

        .stat-card {
            background: #ffffff;
            border-radius: 12px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
            padding: 25px;
            transition: transform 0.3s ease, box-shadow 0.3s ease;
            display: flex;
            flex-direction: column;
        }

        .stat-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
        }

        .stat-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
        }

        .stat-title {
            font-size: 1.1rem;
            font-weight: 500;
            color: #666;
        }

        .stat-icon {
            width: 40px;
            height: 40px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2rem;
        }

        .stat-value {
            font-size: 2.5rem;
            font-weight: bold;
            color: #183a8a;
            margin-bottom: 5px;
        }

        .stat-trend {
            font-size: 0.9rem;
            color: #333;
        }

        .stat-trend.positive {
            color: #00b578;
        }

        .stat-trend.negative {
            color: #ff4d4f;
        }

        .quick-action {
            background: #ffffff;
            border-radius: 12px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
            padding: 25px;
            grid-column: 1 / -1;
        }

        .action-title {
            font-size: 1.3rem;
            font-weight: bold;
            color: #183a8a;
            margin-bottom: 20px;
        }

        .action-buttons {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
        }

        .action-btn {
            background: #f8f9fa;
            border-radius: 10px;
            padding: 15px 20px;
            display: flex;
            align-items: center;
            text-decoration: none;
            color: #333;
            transition: background 0.2s, transform 0.2s;
            min-width: 200px;
            flex: 1;
        }

        .action-btn:hover {
            background: #e8f4ff;
            transform: translateY(-2px);
        }

        .action-icon {
            width: 40px;
            height: 40px;
            border-radius: 8px;
            background: #e8f4ff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2rem;
            color: #183a8a;
            margin-right: 15px;
        }

        .action-text {
            flex: 1;
        }

        .action-name {
            font-weight: 500;
        }

        .action-desc {
            font-size: 0.9rem;
            color: #666;
        }

        @media (max-width: 900px) {
            .sidebar {
                width: 120px;
            }

            .menu-item {
                padding: 18px 0 18px 15px;
                text-align: center;
                font-size: 1rem;
            }

            .main-content {
                padding: 15px;
            }

            .dashboard {
                grid-template-columns: 1fr;
                gap: 15px;
            }

            .welcome-card {
                padding: 20px;
            }

            .welcome-title {
                font-size: 1.8rem;
            }

            .welcome-subtitle {
                font-size: 1rem;
            }

            .welcome-avatar {
                width: 50px;
                height: 50px;
                font-size: 2rem;
            }

            .welcome-name {
                font-size: 1.2rem;
            }

            .welcome-role {
                font-size: 0.9rem;
            }

            .stat-card {
                padding: 20px;
            }

            .stat-value {
                font-size: 2rem;
            }

            .quick-action {
                padding: 20px;
            }

            .action-title {
                font-size: 1.1rem;
            }

            .action-btn {
                padding: 12px 15px;
                min-width: auto;
            }

            .action-icon {
                width: 35px;
                height: 35px;
                font-size: 1rem;
            }

            .action-name {
                font-size: 0.95rem;
            }

            .action-desc {
                font-size: 0.85rem;
            }
        }

    </style>
</head>

<body>
<div class="header">
    <div>欢迎登录公司用车管理系统（用车员工）</div>
    <div class="header-right">
        <div class="user-icon">👤</div>
        <!-- 从 Session 中获取员工账号 -->
        <div class="user-info">账号：<%= employee.getEmployeeID() %></div>
        <div class="bell-icon">🔔</div>
        <a href="${pageContext.request.contextPath}/LogoutServlet" class="logout">退出登录</a>
    </div>
</div>
<div class="container">
    <div class="sidebar">
        <a class="menu-item active" href="#" id="66">
            <i class="fa fa-home"></i> 系统首页
        </a>
        <a class="menu-item" href="shenqing.jsp">
            <i class="fa fa-car"></i> 申请用车
        </a>
        <a class="menu-item" href="jindu.jsp">
            <i class="fa fa-bar-chart"></i> 申请进度
        </a>
        <a class="menu-item" href="lishi.jsp">
            <i class="fa fa-history"></i> 历史订单
        </a>
        <a class="menu-item" href="geren.jsp">
            <i class="fa fa-user"></i> 个人中心
        </a>
    </div>
    <div class="main-content">
        <!-- 美化后的首页内容 -->
        <div class="dashboard">
            <!-- 欢迎卡片 -->
            <div class="welcome-card">
                <div class="welcome-title">公司用车管理系统</div>
                <div class="welcome-subtitle">高效、便捷的企业用车解决方案</div>
                <div class="welcome-user">
                    <div class="welcome-avatar">👤</div>
                    <div>
                        <div class="welcome-name"><%= employee.getEmployeeName() %></div>
                        <div class="welcome-role"><%= employee.getPosition() != null ? employee.getPosition() : "员工" %> | <%= employee.getEmployeeID() %></div>
                    </div>
                </div>
            </div>


            <!-- 快捷操作 -->
            <div class="quick-action">
                <div class="action-title">快捷操作</div>
                <div class="action-buttons">
                    <a href="shenqing.jsp" class="action-btn">
                        <div class="action-icon">
                            <i class="fa fa-plus-circle"></i>
                        </div>
                        <div class="action-text">
                            <div class="action-name">申请用车</div>
                            <div class="action-desc">立即提交用车申请</div>
                        </div>
                    </a>
                    <a href="jindu.jsp" class="action-btn">
                        <div class="action-icon">
                            <i class="fa fa-search"></i>
                        </div>
                        <div class="action-text">
                            <div class="action-name">查看进度</div>
                            <div class="action-desc">跟踪申请处理状态</div>
                        </div>
                    </a>
                    <a href="lishi.jsp" class="action-btn">
                        <div class="action-icon">
                            <i class="fa fa-history"></i>
                        </div>
                        <div class="action-text">
                            <div class="action-name">历史订单</div>
                            <div class="action-desc">查看所有用车记录</div>
                        </div>
                    </a>
                    <a href="geren.jsp" class="action-btn">
                        <div class="action-icon">
                            <i class="fa fa-user"></i>
                        </div>
                        <div class="action-text">
                            <div class="action-name">个人中心</div>
                            <div class="action-desc">管理个人信息</div>
                        </div>
                    </a>
                </div>
            </div>
        </div>
    </div>
</div>
</body>

</html>
